﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/BMP_List.master" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="Pages_View_Review_Product_Default" %>

<asp:Content ID="contentHeader" ContentPlaceHolderID="head" runat="Server">
    <script>
        var xSelectedIDs = "";
        function SelectAll(gvID, cbAll, cbName) {
            $("#" + gvID).find("input[type='checkbox']").each(function () {
                var cb = $(this);
                if (cb.attr("id").indexOf(cbName) >= 0) {
                    if (cbAll.checked) {
                        cb.attr("checked", true);
                        if (xSelectedIDs.indexOf(cb.attr("value")) < 0) {
                            xSelectedIDs += cb.attr("value") + ",";
                        }
                    }
                    else {
                        cb.attr("checked", false);
                        xSelectedIDs = "";
                    }
                }
            });
        }
        function SelectOne(obj) {
            if (obj.checked) {
                xSelectedIDs += obj.value + ",";
            }
            else {
                var xDel = obj.value + ",";
                xSelectedIDs = xSelectedIDs.replace(xDel, "");
            }
        }
        function SelectCheck(value) {
            if (xSelectedIDs != "") {
                $("#hideIDs").val(xSelectedIDs);
                return confirm("确定要" + value+"吗？");
            }
            else {
                alert("请先选择需要操作的评论");
            }
            return false;
        }
    </script>
</asp:Content>
<asp:Content ID="contentSearch" ContentPlaceHolderID="contentPlaceHolderToolBar"
    runat="Server">
    <asp:DropDownList ID="Product" runat="server" Field="Produce_ID" Opt="=">
    </asp:DropDownList>
    从:
    <asp:TextBox ID="fromData" runat="server" Field="ReviewDate" Opt="&#62;=" onFocus="GetMaxDate('toData');"
        ClientIDMode="Static" Width="80">
    </asp:TextBox>
    到
    <asp:TextBox ID="toData" runat="server" Field="ReviewDate" Opt="&#60;=" onFocus="GetMinDate('fromData');"
        ClientIDMode="Static" Width="80">
    </asp:TextBox>
    评论内容
    <asp:TextBox ID="Content" runat="server" Field="Content" Opt="%">
    </asp:TextBox>
    <asp:Button ID="RePublish" runat="server" OnClick="btnRePublish_Click" Text="重发评论" Visible="false"
        OnClientClick="return SelectCheck('重发');" />
    <asp:Button ID="BtnDeleteAll" runat="server" OnClick="btnDeleteAll_Click" Text="批量删除" Visible="false"
        OnClientClick="return SelectCheck('删除');" />
    <input type="hidden" id="hideIDs" runat="server" clientidmode="Static" />
</asp:Content>
<asp:Content ID="contentMain" ContentPlaceHolderID="contentPlaceHolder" runat="Server">
    <asp:GridView ID="gvInfos" runat="server">
        <Columns>
            <asp:TemplateField ItemStyle-Width="50">
                <HeaderTemplate>
                    <input id="cbhALL" type="checkbox" onclick="SelectAll('<% =gvInfos.ClientID %>', this, 'cbItem');" /><label
                        for="cbhALL">选择</label>
                </HeaderTemplate>
                <ItemTemplate>
                    <input type="checkbox" id="cbItem" runat="server" clientidmode="Static" value='<%# Eval("ProduceReview_ID") %>'
                        onclick="SelectOne(this);" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="IP" SortExpression="IP" HeaderText="IP" />
            <asp:BoundField DataField="CustomerName" SortExpression="CustomerName" HeaderText="会员姓名" />
            <asp:TemplateField>
                <HeaderTemplate>
                    评论内容</HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Content").ToString().Length > 10 ? Eval("Content").ToString().Substring(0, 10) : Eval("Content").ToString()%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="star" SortExpression="star" HeaderText="评价等级" />
            <asp:BoundField DataField="Model" SortExpression="Model" HeaderText="所属产品" />
            <asp:BoundField DataField="Area" SortExpression="Area" HeaderText="所在地区" />
            <asp:BoundField DataField="ReviewDate" SortExpression="ReviewDate" HeaderText="评论时间" />
            <asp:TemplateField>
                <HeaderTemplate>
                    是否发布</HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("IsPublish").ToString() =="True" ? "是" : "否"%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    是否回复</HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("reply")!= null ? "是" : "否"%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="CheckBy" SortExpression="CheckBy" HeaderText="审核人" />
            <asp:BoundField DataField="ChectDate" SortExpression="ChectDate" HeaderText="审核时间"
                DataFormatString="{0:yyyy-MM-dd}" />
            <asp:HyperLinkField HeaderText="回复" Text="回复" DataNavigateUrlFields="ManageEditURI"
                ItemStyle-Width="50" />
            <asp:TemplateField HeaderText="删除" ItemStyle-Width="50">
                <ItemTemplate>
                    <asp:LinkButton ID="lbDelete" Text="删除" CausesValidation="true" CommandName="Delete"
                        OnClientClick="return confirm('确定删除吗？');" runat="server">
                    </asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
</asp:Content>
